package ${package}.web.controller.pc;

import ${package}.base.entity.${className};
import ${package}.base.request.pc.${lowerClassName}.${className}AddSTO;
import ${package}.base.request.pc.${lowerClassName}.${className}ModifySTO;
import ${package}.base.request.pc.${lowerClassName}.${className}PageSTO;
import ${package}.base.response.pc.${lowerClassName}.${className}PageDTO;
import ${package}.common.entity.B;
import ${package}.common.entity.R;
import ${package}.common.entity.P;
import ${package}.base.request.IdListSTO;
import ${package}.core.service.${className}Service;

import ${package}.common.annotation.Log;
import ${package}.common.annotation.RolePermissions;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import lombok.AllArgsConstructor;

/**
* @description ${tableComment}-控制层
* @author ${author}
* @date ${date}
* @website https://gitee.com/sunalee/fastboot-vue
**/
@RestController
@AllArgsConstructor
@Api(tags = "PC-${functionName}")
@RequestMapping("/pc/${lowerClassName}")
public class Pc${className}Controller {

    private final ${className}Service ${lowerClassName}Service;

    @Log(value = "${tableComment}-分页列表")
    @ApiOperation(value = "${tableComment}-分页列表")
    @GetMapping("/queryPage")
    @RolePermissions(value = "${lowerClassName}:queryPage")
    public P<${className}PageDTO> queryPage(${className}PageSTO sto) {
        return ${lowerClassName}Service.page( sto );
    }

    @Log(value = "${tableComment}-详情")
    @ApiOperation(value = "${tableComment}-详情")
    @GetMapping("/get")
    @RolePermissions(value = "${lowerClassName}:get")
    public R<${className}> get(${pkColumnType} id){
        return ${lowerClassName}Service.findById( id );
    }

    @Log(value = "${tableComment}-新增")
    @ApiOperation(value = "${tableComment}-新增")
    @PostMapping("/add")
    @RolePermissions(value = "${lowerClassName}:add")
    public R<${className}> add(@RequestBody @Valid ${className}AddSTO sto){
        return ${lowerClassName}Service.add( sto );
    }

    @Log(value = "${tableComment}-编辑")
    @ApiOperation(value = "${tableComment}-编辑")
    @PostMapping("/modify")
    @RolePermissions(value = "${lowerClassName}:modify")
    public B modify(@RequestBody @Valid  ${className}ModifySTO sto){
        return ${lowerClassName}Service.modify( sto );
    }

    @Log(value = "${tableComment}-多选删除")
    @ApiOperation(value = "${tableComment}-多选删除")
    @PostMapping("/del")
    @RolePermissions(value = "${lowerClassName}:del")
    public B deleteAll(@RequestBody @Valid IdListSTO sto){
        return ${lowerClassName}Service.deleteAll( sto );
    }

}